﻿@{
    Layout = null;
}


@using ClassBLL
@using ClassModel
@using ClassCommon

@{
    // 获取用户id
    int userid = HttpCookieHelper.GetUserID();
    t_class_attachment_info attachInfo = t_class_attachment_info_BLL.GetAttachmentByUserId(userid);
    
    if (attachInfo == null)
    {
        // 如果用户没有设置基本信息页面，那么直接跳转到任务列表页面，并让用户设置基本附加信息。
        HttpContext.Current.Response.Redirect("/ScheduleClass/ArrangeTaskList");
    }
}

<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    @Html.Partial("____newestCommonJsCss")
    <link rel="stylesheet" href="/static/newestHTML/assets/css/city-picker.css" />
    <script src="/static/newestHTML/assets/js/city-picker.data.js"></script>
    <script src="/static/newestHTML/assets/js/city-picker.js"></script>
    <title>@(string.IsNullOrEmpty(ViewBag.Title) ? "华志创排课" : ViewBag.Title)</title>
    <!-- 样式导入 -->
    @RenderSection("style", false)

    <style type="text/css">
        .tipText {
            font-size : 15px !important;
        }
    </style>
</head>

<body>
    <!-- 公用头部 -->
    @Html.Partial("___newestHeader")
    <div class="contentOne col-lg-12 col-md-12 col-sm-12">
        <!-- 左边公用的菜单栏 -->
        @Html.Partial("___newestLeftMeun")
        <div class="conCon col-lg-8 col-md-6 col-sm-12">
            <!-- body begin --->
            @RenderBody()
            <!-- body end --->
        </div>
        <!-- 右边公用的帮助菜单栏 -->
        @Html.Partial("___newestRightHelperHTML")

        <!-- 上传modal -->
        <div class="bg3" style="display: none;">
            <div class="container">
                <div class="row">
                    <div class="col-lg-4 col-md-7 col-sm-10 tc3">
                        <div class="ttc3">
                            <span>上传课时和教师信息</span>
                            <span></span>
                        </div>
                        <div class="uploading col-lg-12 col-md-12 col-sm-12">
                            <ul>
                                <li class="col-lg-5">
                                    <img src="/static/newestHTML/assets/css/images/index2/img.png" /></li>
                                <li class="col-lg-7">请按照模板填写信息，其中"4+1"表示4节单堂一节连堂，共六课时。</li>
                            </ul>
                        </div>
                        <div class="toLead">

                            @*<input type="button" id="picker" name="import" value="导入数据" />*@
                            <div id="picker">导入数据</div>
                            <span>关闭</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- 个人信息设置弹窗 modal -->
        <div class="bg2" style="display: none;">
            <div class="container">
                <div class="row">
                    <div class="col-lg-4 col-md-7 col-sm-10 tc2">
                        <div class="ttc2">
                            <span>完善信息</span>
                            <span>完善后可免费获得排课秘籍</span>
                            @if (attachInfo != null)
                            { 
                                <span></span>    
                            }
                        </div>
                        <div class="col-lg-11 col-md-10 col-sm-12 information">
                            <p>学校信息</p>
                            <p class="col-lg-12 col-md-12 col-sm-12">
                                学校全称：
								<sup class="icon1"></sup>
                                <input type="text" placeholder="请填写学校全称" id="schoolName" value="@(attachInfo != null ? attachInfo.SchoolName : string.Empty)" />
                                <span>学校全称必填</span>

                            </p>

                            <p class="col-lg-12 col-md-12 col-sm-12">
                                所在地区：
								<sup class="icon1"></sup>
                                <input type="text" id="address" data-toggle="city-picker"  value="@(attachInfo != null ? attachInfo.Address : string.Empty)" placeholder="点击下拉面板中选择省/市/区" data-level="district">
                            </p>
                            <p class="col-lg-12 col-md-12 col-sm-12">
                                学校类型：
								<sup class="icon1"></sup>
                                <select name="" id="schoolType">
                                    <option value="0" @(attachInfo == null ? Html.Raw("selected='seleted'") : Html.Raw(""))>选择学校类型</option>
                                    @if (attachInfo == null)
                                    {
                                        <option value="1">小学</option>
                                        <option value="2">初中</option>
                                        <option value="3">高中</option>
                                        <option value="4">完全中学</option>
                                        <option value="5">大学</option>
                                        <option value="6">培训机构</option>
                                        <option value="7">竞品公司</option>
                                        <option value="8">其他</option>    
                                    }
                                    else
                                    {
                                        <option value="1" @(attachInfo.SchoolType == "1" ? Html.Raw("selected='seleted'") : Html.Raw(""))>小学</option>
                                        <option value="2" @(attachInfo.SchoolType == "2" ? Html.Raw("selected='seleted'") : Html.Raw(""))>初中</option>
                                        <option value="3" @(attachInfo.SchoolType == "3" ? Html.Raw("selected='seleted'") : Html.Raw(""))>高中</option>
                                        <option value="4" @(attachInfo.SchoolType == "4" ? Html.Raw("selected='seleted'") : Html.Raw(""))>完全中学</option>
                                        <option value="5" @(attachInfo.SchoolType == "5" ? Html.Raw("selected='seleted'") : Html.Raw(""))>大学</option>
                                        <option value="6" @(attachInfo.SchoolType == "6" ? Html.Raw("selected='seleted'") : Html.Raw(""))>培训机构</option>
                                        <option value="7" @(attachInfo.SchoolType == "7" ? Html.Raw("selected='seleted'") : Html.Raw(""))>竞品公司</option>
                                        <option value="8" @(attachInfo.SchoolType == "8" ? Html.Raw("selected='seleted'") : Html.Raw(""))>其他</option>    
                                    }

                                </select>
                                <span>学校类型必选</span>
                            </p>

                        </div>
                        <div class="col-lg-11 col-md-10 col-sm-12 oneInformation">
                            <p>个人信息</p>
                            <p class="col-lg-12 col-md-12 col-sm-12">
                                <span class="col-lg-6 col-md-12 col-sm-12 zw">您的职务：
									<sup class="icon1"></sup>
                                    <select name="" id="jobType">
                                        <option value="0" @(attachInfo == null ? Html.Raw("selected='seleted'") : Html.Raw(""))>选择您的职务</option>
                                        @if (attachInfo == null)
                                        { 
                                            <option value="1">教务处负责人</option>
                                            <option value="2">信息负责人</option>
                                            <option value="3">年级主任</option>
                                            <option value="4">教学组长</option>
                                            <option value="5">理科教师</option>
                                            <option value="6">文科教师</option>
                                            <option value="7">教学副校长</option>    
                                        }
                                        else
                                        {
                                            <option value="1" @(attachInfo.Duty == "1" ? Html.Raw("selected='seleted'") : Html.Raw(""))>教务处负责人</option>
                                            <option value="2" @(attachInfo.Duty == "2" ? Html.Raw("selected='seleted'") : Html.Raw(""))>信息负责人</option>
                                            <option value="3" @(attachInfo.Duty == "3" ? Html.Raw("selected='seleted'") : Html.Raw(""))>年级主任</option>
                                            <option value="4" @(attachInfo.Duty == "4" ? Html.Raw("selected='seleted'") : Html.Raw(""))>教学组长</option>
                                            <option value="5" @(attachInfo.Duty == "5" ? Html.Raw("selected='seleted'") : Html.Raw(""))>理科教师</option>
                                            <option value="6" @(attachInfo.Duty == "6" ? Html.Raw("selected='seleted'") : Html.Raw(""))>文科教师</option>
                                            <option value="7" @(attachInfo.Duty == "7" ? Html.Raw("selected='seleted'") : Html.Raw(""))>教学副校长</option>    
                                        }

                                    </select>
                                    <span>职务必选</span>
                                </span>
                                <span class="col-lg-6 col-md-12 col-sm-12 nn">您的年龄：
									<sup class="icon1"></sup>
                                    <select name="" id="ageArrange">
                                        <option value="0" @(attachInfo == null ? Html.Raw("selected='seleted'") : Html.Raw(""))>选择您的年龄</option>
                                        @if (attachInfo == null)
                                        { 
                                            <option value="1">20岁-25岁</option>
                                            <option value="2">25岁-30岁</option>
                                            <option value="3">30岁-35岁</option>
                                            <option value="4">35岁-40岁</option>
                                            <option value="5">40岁-45岁</option>
                                            <option value="6">45岁-50岁</option>
                                            <option value="7">50岁以上</option>
                                        }
                                        else
                                        {
                                            <option value="1" @(attachInfo.AgeRange == "1" ? Html.Raw("selected='seleted'") : Html.Raw(""))>20岁-25岁</option>
                                            <option value="2" @(attachInfo.AgeRange == "2" ? Html.Raw("selected='seleted'") : Html.Raw(""))>25岁-30岁</option>
                                            <option value="3" @(attachInfo.AgeRange == "3" ? Html.Raw("selected='seleted'") : Html.Raw(""))>30岁-35岁</option>
                                            <option value="4" @(attachInfo.AgeRange == "4" ? Html.Raw("selected='seleted'") : Html.Raw(""))>35岁-40岁</option>
                                            <option value="5" @(attachInfo.AgeRange == "5" ? Html.Raw("selected='seleted'") : Html.Raw(""))>40岁-45岁</option>
                                            <option value="6" @(attachInfo.AgeRange == "6" ? Html.Raw("selected='seleted'") : Html.Raw(""))>45岁-50岁</option>
                                            <option value="7" @(attachInfo.AgeRange == "7" ? Html.Raw("selected='seleted'") : Html.Raw(""))>50岁以上</option>
                                        }

                                    </select>
                                    <span>年龄必选</span>
                                </span>
                            </p>
                            <p class="col-lg-12 col-md-12 col-sm-12" style="overflow: hidden; padding-top: 5px;">
                                联系电话：
								<sup class="icon1"></sup>
                                <input type="text" name="" id="phone" value="@(attachInfo != null ? attachInfo.PhoneNum : string.Empty)" placeholder="请填写您的联系电话" />
                                <span>无法联系电话</span>
                            </p>
                            <p class="col-lg-12 col-md-12 col-sm-12">
                                联系QQ：
								<input style="margin-left: 5px;" id="qqNumber" type="text" value="@(attachInfo != null ? attachInfo.QQ : string.Empty)" placeholder="请填写您的QQ" />
                            </p>
                            <p class="col-lg-12 col-md-12 col-sm-12">
                                联系邮箱：
								<input type="text" placeholder="请填写您的邮箱" id="email" value="@(attachInfo != null ? attachInfo.Email : string.Empty)" />
                                <span>无效联系邮箱</span>
                            </p>
                        </div>
                        <p class="col-lg-6 col-md-8 col-sm-10 TJ">
                            <input type="button" id="bc2" value="保存" />
                            @if (attachInfo != null)
                            {
                                <input type="button" id="qx1" value="取消" />    
                            }
                        </p>
                    </div>

                </div>
            </div>
        </div>
    </div>

    <!-- 确定 & 取消 -->
    <div class="popup op_confirm_cancel" style="display: none;">
        <div class="container">
            <div class="row">
                <div class="col-lg-3 col-md-6 col-sm-10 popuptext">
                    <p>操作提示</p>
                    <p>你正在执行XXX操作，确定要这么做吗？</p>
                    <p>
                        <input type="button" name="" id="" value="确定" />
                        <input type="button" name="" id="" value="取消" />
                    </p>
                </div>
            </div>
        </div>
    </div>

    <!-- 确定  -->
    <div class="popup op_confirm" style="display: none;">
        <div class="container">
            <div class="row">
                <div class="col-lg-3 col-md-6 col-sm-10 popuptext">
                    <p>操作提示</p>
                    <p>你还没有上传课表信息，不能设置节次信息。</p>
                    <p>
                        <input style="width: 100%;" type="button" name="" id="" value="确定" />
                    </p>
                </div>
            </div>
        </div>
    </div>

    <!-- 操作成功 -->
    <div class="popup op_success" style="display: none;">
        <div class="container">
            <div class="row">
                <div class="col-lg-3 col-md-6 col-sm-10 popuptext popupY">
                    <p>xxx操作成功！</p>
                </div>
            </div>
        </div>
    </div>

    <!-- 操作失败 -->
    <div class="popup op_failure" style="display: none;">
        <div class="container">
            <div class="row">
                <div class="col-lg-3 col-md-6 col-sm-10 popuptext popupN">
                    <p class="col-lg-8 col-md-9 col-sm-12">xxx操作失败！</p>
                </div>
            </div>
        </div>
    </div>
</body>
</html>

<script type="text/javascript" src="/static/newestHTML/assets/js/js.js"></script>
<script type="text/javascript">

    $(function () {
        $("div.toLead span").on("click", function () {
            $(".bg3").css("display", "none");
        })

        // 取消隐藏个人信息框
        $("#qx1").on("click", function () {
            $(".bg2").css("display", "none");
        })


        // 点击保存用户个人信息
        $("#bc2").on("click", function () {
            var result = validateForm();
            if (result) {
                result.operation = "update";
                $.ajax({
                    url: "/ScheduleClass/AddAttachment",
                    type: "POST",
                    data: result,
                    dataType: "json",
                    success: function (data) {
                        if (data.status) {
                            // alert("数据添加成功!");
                            window.location.reload();
                        }
                    }
                })
            }
        })

        $(".bg2 input").focus(function () {
            $(this).next().hide();
        })
    })

    // 显示错误信息
    function showFailure(message) {
        // 还未选择不排课数据
        $(".op_failure").css("display", "block");
        $(".op_failure").find("p").addClass("tipText");
        $(".op_failure").find("p").text(message);
        setTimeout(function () {
            $(".op_failure").fadeOut("fast");
        }, 1500);
    }

    // 显示成功信息
    function showSuccess(message) {
        $(".op_success").css("display", "block");
        $(".op_success").find("p").addClass("tipText");
        $(".op_success").find("p").text(message);
        setTimeout(function () {
            $(".op_success").fadeOut("fast");
        }, 1500);
    }


    function validateForm() {
        //学校全称
        var $schoolType = $('.information p:nth-child(2) input');
        if ($schoolType.val() == '') {
            $('.information p:nth-child(2) span').css('display', 'block');
            return false;
        } else {
            $('.information p:nth-child(2) span').css('display', 'none');
        }


        //学校类型
        var $schoolType = $('.information p:nth-child(4) select');

        if ($schoolType.val() == 0) {
            $('.information p:nth-child(4) span').css('display', 'block');
            return false;
        } else {
            $('.information p:nth-child(4) span').css('display', 'none');
        }


        //您的职务
        var $jobType = $('.oneInformation p:nth-child(2) select');
        if ($jobType.val() == 0) {
            $('.oneInformation p:nth-child(2) span:nth-child(1) span').css('display', 'block');
            return false;
        } else {
            $('.oneInformation p:nth-child(2) span:nth-child(1) span').css('display', 'none');
        }


        //您的年龄
        var $ageArrange = $('.oneInformation p:nth-child(2) span:nth-child(2) select');
        if ($ageArrange.val() == '0') {
            $('.nn span').css('display', 'block');
            return false;
        } else {
            $('.nn span').css('display', 'none');
        }


        //联系电话
        var val = $('.oneInformation p:nth-child(3) input').val();
        var reg = /^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/;
        if (!reg.test(val)) {
            $('.oneInformation p:nth-child(3) span').css('display', 'block');
            return false;
        } else {
            $('.oneInformation p:nth-child(3) span').css('display', 'none');
        }


        //邮箱验证
        var val = $('.oneInformation p:nth-child(5) input').val();
        var reg = /^(\w-*\.*)+@@(\w-?)+(\.\w{2,})+$/;
        if (!reg.test(val)) {
            $('.oneInformation p:nth-child(5) span').css('display', 'block');
            return false;
        } else {
            $('.oneInformation p:nth-child(5) span').css('display', 'none');
        }

        /*
             schoolName, -- 学校名称
             qqNumber, -- QQ号码
    area, -- 地区
     phone, -- 手机
        schoolType, -- 学校类型id
    jobType, -- 职责类型id
        ageArrange, -- 年龄范围id
        email -- 邮箱
             * */
        return {
            schoolName: $("#schoolName").val(),
            qqNumber: $("#qqNumber").val(),
            area: $("#address").val(),
            phone: $("#phone").val(),
            schoolType: $("#schoolType").val(),
            jobType: $("#jobType").val(),
            ageArrange: $("#ageArrange").val(),
            email: $("#email").val()
        };
    }




</script>
<!-- js 导入 -->
@RenderSection("script", false)



